﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// 用户点击的点形成路径
    /// </summary>
    public class CustomPathShape : Shape
    {
        private List<Point> pathPoints;

        public CustomPathShape(string name, Point startPoint, Color color) : base(startPoint, color, name)
        {
            pathPoints = new List<Point>();
            pathPoints.Add(startPoint);
            TrajectoryPoints = pathPoints; // 直接使用路径点作为轨迹点
        }

        public override void Draw(Graphics g)
        {
            if (pathPoints.Count > 1)
            {
                using (Pen pen = new Pen(Color, 1))
                {
                    g.DrawLines(pen, pathPoints.ToArray());
                }
            }
        }

        public override void Update(Point currentPoint)
        {
            pathPoints.Add(currentPoint);
        }


    }
}
